//
//  ZLPullMenuContentReusableView.swift
//  ZLPullMenuSwift
//
//  Created by 科大 on 2025/1/16.
//

import UIKit
import SnapKit

public class ZLPullMenuContentReusableView: UICollectionReusableView {
    // MARK: - Properties
    
    /// 标题
    public var group: ZLPullMenuGroup? {
        didSet {
            updateUI()
        }
    }
    
    /// 标题标签
    private lazy var titleLabel: UILabel = {
        let label = UILabel()
        return label
    }()
    
    // MARK: - Initialization
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - Private Methods
    
    private func updateUI() {
        guard let group = group else { return }
        
        titleLabel.textColor = group.config.textColor
        titleLabel.font = group.config.font
        titleLabel.text = group.groupTitle
    }
}
